<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>绝对定位</title>
		<style>
			div{
				width: 100px;
				height: 100px;
				border: 1px solid red;
			}
			#d1{
				/* 设置为绝对定位 */
				position: absolute;
				/* 相对与窗口做偏移 */
				right: 0;
				bottom: 0;
			}
			#d2{
				width: 200px;
				height: 200px;
				background-color: red;
				margin: 100px 0 0 100px;
				position: relative;
			}
			#d2>div{
				width: 100px;
				height: 100px;
				margin: 50px 0 0 50px;
				background-color: blue;
			}
			#d2>div>div{
				width: 50px;
				height: 50px;
				background-color: green;
				/* 绝对定位：相对与某个元素进行偏移就在谁的样式中添加相对定位 */
				position: absolute;
				top: 0;
				left: 0;
			}
		</style>
	</head>
	<body>
		<div id="d2">
			<div>
				<div></div>
			</div>
		</div>
		
		<div id="d1">div1</div>
		<div>div2</div>
		<div>div3</div>
	</body>
</html>